package com.example.flutter_base_widget.plugin

import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import com.baidu.mapapi.CoordType
import com.baidu.mapapi.SDKInitializer
import com.baidu.mapapi.map.BaiduMap
import com.baidu.mapapi.map.MapView
import com.baidu.mapapi.map.TextureMapView
import com.example.flutter_base_widget.R
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.platform.PlatformView

class MyView internal constructor(mapView: TextureMapView) : PlatformView, MethodChannel.MethodCallHandler {

//    private val mNativeView: TextView
//    private val methodChannel: MethodChannel
    private val mmapView: TextureMapView
    init {
//        mNativeView = TextView(context)
//        mNativeView.setText("我是来自原生的控件我是来自原生的控件我是来自原生的控件我是来自原生的控件我是 来自原生的控件我是来自原生的控件我是来自原生的控件我是来自原生的控件我是来自原生的控件")
//        mNativeView.setTextColor(Color.BLUE)
//
//        methodChannel = MethodChannel(messenger,"myview$id")
//        methodChannel.setMethodCallHandler(this)
//        var view = LayoutInflater.from(context).inflate(R.layout.layout, null)
        mmapView = mapView
    }

    override fun getView(): View {
        return mmapView
    }

    override fun dispose() {
    }

    override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
        print("=====>"+call.method)
        result.success("调用成功")
    }

}
